package org.example.service.impl;

import org.example.dao.SysUserDao;
import org.example.entity.SysUserEntity;
import org.example.service.SysUserService;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.Date;

@Service
public class SysUserServiceImpl extends TrCacheServiceImpl<SysUserDao, SysUserEntity> implements SysUserService {

    public SysUserEntity getById(Serializable userId) {

        SysUserEntity info = this.baseMapper.selectById(userId);
        info.setPassword(null);

        return info;
    }

    @Override
    public boolean updateById(SysUserEntity entity) {

        entity.setUpdateTime(new Date());

        boolean result = super.updateById(entity);

        clearCache();

        return result ;
    }
}
